package com.an.framework.security.user.vo;

import java.util.Collection;
import java.util.List;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

public class User implements UserDetails {
	/**
	 * serialVersionUID:序列化号.
	 * @since JDK 1.8
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * username:用户名.
	 * @since JDK 1.8
	 */
	private String username;
	/**
	 * password:密码.
	 * @since JDK 1.8
	 */
	private String password;
	/**
	 * sex:性别（男/女）.
	 * @since JDK 1.8
	 */
	private String sex;
	/**
	 * phoneNumber:电话号码.
	 * @since JDK 1.8
	 */
	private String phoneNumber;
	/**
	 * email:邮箱.
	 * @since JDK 1.8
	 */
	private String email;
	
	/**
	 * authorities:权限列表.
	 * @since JDK 1.8
	 */
	private List<Authority> authorities;
	

	public User() {
		super();
	}

	public User(String username, String password, String sex, String phoneNumber, String email) {
		super();
		this.username = username;
		this.password = password;
		this.sex = sex;
		this.phoneNumber = phoneNumber;
		this.email = email;
	}
	
	public void setAuthorities(List<Authority> authorities) {
		this.authorities = authorities;
	}

	
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getPhoneNumber() {
		return this.phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	
	public Collection<? extends GrantedAuthority> getAuthorities() {
		
		return this.authorities;
	}

	
	public boolean isAccountNonExpired() {
		
		return true;
	}

	
	public boolean isAccountNonLocked() {
		return true;
	}

	
	public boolean isCredentialsNonExpired() {
		
		return true;
	}

	
	public boolean isEnabled() {
		
		return true;
	}

	
	public String toString() {
		return "User [username=" + username + ", password=" + password + ", sex=" + sex + ", phoneNumber=" + phoneNumber
				+ ", email=" + email + ", authorities=" + authorities + "]";
	}

}
